//
//  MCLeftTableCell.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/5/17.
//

import UIKit
import SnapKit
import QMUIKit

class MCLeftTableCell: UITableViewCell {
    
    var titleInfLabel:QMUILabel!
    var headerImageView:UIImageView!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        if headerImageView != nil {
            headerImageView.isHidden = !selected
        }
        contentView.backgroundColor = selected ? .white : UIColor.qmui_color(withHexString: "#F7F7F9")
        if selected {
            titleInfLabel.textColor = .qmui_color(withHexString:"#10151C")
            titleInfLabel.font = UIFont(name: "PingFangSC-Semibold", size: 13)
        } else {
            titleInfLabel.textColor = .qmui_color(withHexString:"#777D83")
            titleInfLabel.font = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight(600))
            titleInfLabel.font = UIFont(name: "PingFangSC-Regular", size: 13)
        }
        // Configure the view for the selected state
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        loadWithSubView()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func loadWithSubView() -> Void {
        
        
      
        
        let titleInfoLabel = QMUILabel.init()
        titleInfoLabel.textColor = UIColor.qmui_color(withHexString: "#333333")
        titleInfoLabel.font = UIFont(name: "PingFangSC-Regular", size: 13)
        contentView.addSubview(titleInfoLabel)
        titleInfoLabel.snp.makeConstraints { make in
            make.centerX.equalTo(contentView.snp.centerX).offset(0)
            make.centerY.equalTo(contentView.snp.centerY).offset(0)
        }
        
        titleInfLabel = titleInfoLabel
        
        
        headerImageView = UIImageView.init()
        headerImageView.image = UIImage(named: "vip_quan_yi_image")
        self.contentView.addSubview(headerImageView)
        headerImageView.snp.makeConstraints { make in
            make.right.equalTo(titleInfoLabel.snp.left).offset(-5)
            make.centerY.equalTo(contentView.snp.centerY).offset(0)
            make.width.height.equalTo(12.0)
        }
        
    }
    
}
